home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qbrush.h.z / qbrush.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.4 KB  |  85 lines

  1. /****************************************************************************
  2. ** $Id: qbrush.h,v 2.4 1998/07/03 00:09:30 hanord Exp $
  3. **
  4. ** Definition of QBrush class
  5. **
  6. ** Created : 940112
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QBRUSH_H
  25. #define QBRUSH_H
  26.  
  27. #ifndef QT_H
  28. #include "qcolor.h"
  29. #include "qshared.h"
  30. #endif // QT_H
  31.  
  32.  
  33. enum BrushStyle                    // brush style
  34.       { NoBrush, SolidPattern,
  35.     Dense1Pattern, Dense2Pattern, Dense3Pattern, Dense4Pattern,
  36.     Dense5Pattern, Dense6Pattern, Dense7Pattern,
  37.     HorPattern, VerPattern, CrossPattern,
  38.     BDiagPattern, FDiagPattern, DiagCrossPattern, CustomPattern=24 };
  39.  
  40.  
  41. class QBrush
  42. {
  43. friend class QPainter;
  44. public:
  45.     QBrush();
  46.     QBrush( BrushStyle );
  47.     QBrush( const QColor &, BrushStyle=SolidPattern );
  48.     QBrush( const QColor &, const QPixmap & );
  49.     QBrush( const QBrush & );
  50.    ~QBrush();
  51.     QBrush &operator=( const QBrush & );
  52.  
  53.     BrushStyle    style()     const        { return data->style; }
  54.     void    setStyle( BrushStyle );
  55.     const QColor &color()const        { return data->color; }
  56.     void    setColor( const QColor & );
  57.     QPixmap    *pixmap() const        { return data->pixmap; }
  58.     void    setPixmap( const QPixmap & );
  59.  
  60.     bool    operator==( const QBrush &p ) const;
  61.     bool    operator!=( const QBrush &b ) const
  62.                     { return !(operator==(b)); }
  63.  
  64. private:
  65.     QBrush    copy()    const;
  66.     void    detach();
  67.     void    init( const QColor &, BrushStyle );
  68.     struct QBrushData : public QShared {    // brush data
  69.     BrushStyle style;
  70.     QColor      color;
  71.     QPixmap     *pixmap;
  72.     } *data;
  73. };
  74.  
  75.  
  76. /*****************************************************************************
  77.   QBrush stream functions
  78.  *****************************************************************************/
  79.  
  80. QDataStream &operator<<( QDataStream &, const QBrush & );
  81. QDataStream &operator>>( QDataStream &, QBrush & );
  82.  
  83.  
  84. #endif // QBRUSH_H
  85.